main
Sub Main
	dim doc
	set doc = application.activedocument
	Dim P,outputpath
	P= SplitPath(doc.FullName)	
	outputpath = P & "\output"
	newFolder(outputpath)
	wsh_run outputpath
End Sub

sub wsh_run(value)
	dim wsh
	set wsh = createobject("wscript.shell")
	wsh.run value
	set wsh = nothing
end sub

sub newFolder(folderpath)
	dim fso
	set fso = createobject("scripting.filesystemobject")
	if fso.folderExists(folderpath)=false then
		'msgbox folderpath
		fso.createfolder folderpath
	end if
	set fso=nothing
end sub
function SplitPath(InString)
	Dim x,PathString, FileString
	For x = Len(InString) To 1 Step -1
		If Mid(InString, x, 1)="\" Then
			PathString = Left(InString, x)
			FileString = Right(InString, Len(InString) - x)
			Exit For
		End If
	Next x
	SplitPath = PathString
End function
